#include "brush_api.h"

UIbrush JOUI::Jo_UIbrush_Create(INT argb)
{
	return new UIBrush(argb);
}

UIbrush JOUI::Jo_UIbrush_CreatefromCv(LPVOID hCanvas, INT extendmode, DWORD alpha)
{
	return new UIBrush((UICanvas*)hCanvas, (BrushModeEx)extendmode, alpha);
}

UIbrush JOUI::Jo_UIbrush_CreatefromImg(UIimage hImg, INT Mode, INT extendmode, DWORD alpha)
{
	return new UIBrush((UIImage*)hImg, Mode, (BrushModeEx)extendmode, alpha);
}

UIbrush JOUI::Jo_UIbrush_Createlinear(FLOAT xStart, FLOAT yStart, FLOAT xEnd, FLOAT yEnd, INT crBegin, INT crEnd, INT extendmode, BOOL isGamma1_0)
{
	return new UIBrush(xStart, yStart, xEnd, yEnd, crBegin, crEnd, (BrushModeEx)extendmode, isGamma1_0);
}

void JOUI::Jo_UIbrush_SetColor(UIbrush hBrush, INT argb)
{
	auto lpBrush = (UIBrush*)hBrush;
	if (lpBrush)
	{
		lpBrush->SetColor(argb);
	}
}

INT JOUI::Jo_UIbrush_GetColor(UIbrush hBrush)
{
	auto lpBrush = (UIBrush*)hBrush;
	if (lpBrush)
	{
		UIColor argb;
		lpBrush->GetColor(argb);
		return argb.GetARGB();
	}
	return 0;
}

void JOUI::Jo_UIbrush_destroy(UIbrush hBrush)
{
	auto lpBrush = (UIBrush*)hBrush;
	if (lpBrush)
	{
		delete lpBrush;
	}
}

